<?php

/**
 * 新生活动(寝室查询，订棉被)消息发送
 *
 * @author hjc19850430@gmail.com
 */
class NewStudentActivityMsgtpl extends BaseMsgtpl
{

	/**
	 * 给用户发消息
	 */
	public function sendMessageToUser($orderInfo)
	{
		$wechat = D('Wechat')->get($orderInfo['wechat_id']);
		session('account_id', $wechat['account_id']);
		$fans = D('Fans')->get($orderInfo['fans_id'], 'openid,subscribe,wechat_id');
		$url = 'wap.xt.beescrm.com/' . U('base/newStudentActivity/shopIndex', array('wechat_id' => $orderInfo['wechat_id']));
		if($fans['subscribe']) {
			$this->wxTplSign = '-wKq2Sg22MBCCCsT_uVwOSOfMm1l0aRtml1vMlWLB88';
			$info = array(
				'first' => array("value" => '你已成功购买' . $orderInfo['goods_name'], 'color' => '#173177'),
				'keyword1' => array("value" => $orderInfo['username']),
				'keyword2' => array("value" => $orderInfo['order_price'], "color" => "#173177"),
				'keyword3' => array("value" => date('Y-m-d H:i'), "color" => "#173177"),
				'remark' => array("value" => '详情请登录系统查看'),
			);

			$this->wxObj->messageTpl($wechat['appid'], $wechat['appsecret'], $fans['openid'], $this->wxTplSign, $info, $url);
		}
	}

}
